﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

public partial class MySqlQuery : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            try
            {
                Literal1.Text += "<<table>\n>";
                Literal1.Text += "<<th>\n>";
                Literal1.Text += "<<td>内部序号</td>\n>";
                Literal1.Text += "<<td>标题</td>\n>";
                Literal1.Text += "<<td>内容</td>\n>";
                Literal1.Text += "<<td>发布时间</td>\n>";
                Literal1.Text += "<<td>作者</td>\n>";
                Literal1.Text += "<<td>查看次数</td>\n>";
                Literal1.Text += "<<td>分类</td>\n>";
                Literal1.Text += "<</th>\n>";

                Literal1.Text = "<table>\n";
                foreach (var data in InfoDao.FindAll())
                {
                    Literal1.Text += "<<tr>\n>";
                    Literal1.Text += "<<th>"+data.Id+"</th>\n>";
                    Literal1.Text += "<<th>" + data.Title + "</th>\n>";
                    Literal1.Text += "<<th>" + data.Content + "</th>\n>";
                    Literal1.Text += "<<th>" + data.PublishTime + "</th>\n>";
                    Literal1.Text += "<<th>" + data.Author + "</th>\n>";
                    Literal1.Text += "<<th>" + data.ClickNumber + "</th>\n>";
                    Literal1.Text += "<<th>" + data.CategoryMark + "</th>\n>";
                    Literal1.Text += "<</tr>\n>";
                }
                Literal1.Text += "</table>n";
            }
            catch (Exception)
            {
                Literal1.Text = "数据加载异常!";
            }

        }
    }
}